package indi.dawn.superjumper.util;

import com.badlogic.gdx.Gdx;

/** A simple helper class to log the heap per seconds achieved. Just invoke the {@link #log()} method in your rendering method.
 * The output will be logged once per second.
 * 
 * */
public class HEAPLogger {
	long startTime;

	public HEAPLogger () {
		startTime = System.currentTimeMillis();
	}

	/** Logs the current frames per second to the console. */
	public void log () {
		if (System.currentTimeMillis() - startTime > 1000) {
			Gdx.app.log("HEAPLogger", "javaH: " + Gdx.app.getJavaHeap());
			Gdx.app.log("HEAPLogger", "nativeH: " + Gdx.app.getNativeHeap());
			startTime = System.currentTimeMillis();
		}
	}
}
